#include <stdio.h>
#include "locals.h"
#include "../model/globals.h"
#include "../normalization/normalization_globals.h"

NormalizedAtomicConcept*** strict_subsumers;
NormalizedAtomicConcept*** direct_subsumers;
NormalizedAtomicConcept*** equivalents;

int* strict_subsumers_count;
int* direct_subsumers_count;
int* equivalents_count;

void print_equivalents(NormalizedAtomicConcept* a, FILE* output) {
	int i;

	if (equivalents_count[a->id] == 0) return;

	fprintf(output, "EquivalentClasses(\n  %s\n",a->name);
	for (i = 0; i < equivalents_count[a->id]; ++i)
		fprintf(output, "  %s\n", equivalents[a->id][i]->name);
	fprintf(output, ")\n");
}

void print_direct_subsumers(NormalizedAtomicConcept* a, FILE* output) {
	int i;

	for (i = 0; i < direct_subsumers_count[a->id]; ++i)
		fprintf(output, "SubClassOf(%s %s)\n", a->name, direct_subsumers[a->id][i]->name);
}

void print_concept_hierarchy(FILE* output) {
	int i;

	for (i = 0; i < atomic_concept_count; ++i) {
		print_equivalents(normalized_atomic_concepts[i]->description.atomic, output);
		print_direct_subsumers(normalized_atomic_concepts[i]->description.atomic, output);
	}
}
